home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.awt.image.ImageObserver;
- import java.awt.image.MemoryImageSource;
- import java.awt.image.PixelGrabber;
- import java.net.URL;
-
- public class screw extends Applet implements Runnable {
- // $FF: renamed from: rn java.lang.Thread
- Thread field_0;
- Color bgc;
- int bgi;
- // $FF: renamed from: i int
- int field_1;
- // $FF: renamed from: j int
- int field_2;
- int num;
- int durum;
- // $FF: renamed from: cw int
- int field_3;
- // $FF: renamed from: ch int
- int field_4;
- int dly;
- // $FF: renamed from: fd int
- int field_5;
- // $FF: renamed from: ci int
- int field_6 = 1;
- // $FF: renamed from: md int
- int field_7;
- int md2;
- int cit;
- // $FF: renamed from: wp int
- int field_8 = 100;
- // $FF: renamed from: tm int
- int field_9;
- int crr = 1;
- // $FF: renamed from: w int
- int field_10;
- // $FF: renamed from: h int
- int field_11;
- // $FF: renamed from: X int
- int field_12;
- // $FF: renamed from: Y int
- int field_13;
- // $FF: renamed from: sc int
- int field_14;
- int inout;
- // $FF: renamed from: mx int
- int field_15;
- // $FF: renamed from: my int
- int field_16;
- int acisay;
- int modd;
- double alfasin;
- double alfa;
- Image[] img;
- // $FF: renamed from: oi java.awt.Image
- Image field_17;
- Image offi;
- // $FF: renamed from: bs java.lang.String
- String field_18 = "";
- String errstr = "";
- String regcode = "";
- String target_frame = "_self";
- String infostr = "";
- String ialign = "";
- String ivalign = "";
- MediaTracker tracker;
- String[] links;
- String[] stb;
- int[] imgw;
- int[] imgh;
- // $FF: renamed from: pg java.awt.image.PixelGrabber
- PixelGrabber field_19;
- // $FF: renamed from: dt int[][]
- int[][] field_20;
- MemoryImageSource MIS;
- Graphics offg2;
- int[] isle;
- // $FF: renamed from: rg boolean
- boolean field_21 = false;
- boolean whb = false;
- // $FF: renamed from: u java.net.URL
- URL field_22;
- int[] dur;
- double[] acd;
-
- public void init() {
- this.field_10 = -1;
- this.field_11 = -1;
- this.whb = false;
- ((Component)this).setBackground(Color.white);
- this.bgi = this.method_0(((Applet)this).getParameter("bgcolor"), 16, 0);
- this.dly = this.method_0(((Applet)this).getParameter("transition_delay"), 10, 100);
- this.field_8 = this.method_0(((Applet)this).getParameter("delay"), 10, 1000);
- this.field_14 = this.method_0(((Applet)this).getParameter("step_count"), 10, 20);
- this.modd = this.method_0(((Applet)this).getParameter("mode"), 10, 0);
- this.modd %= 2;
- this.bgc = new Color(this.bgi);
- this.tracker = new MediaTracker(this);
- this.field_1 = 1;
- this.regcode = ((Applet)this).getParameter("regcode");
- if (this.regcode != null && this.regcode.equals("screw45yrh4")) {
- this.field_21 = true;
- }
-
- this.target_frame = ((Applet)this).getParameter("target_frame");
- this.infostr = ((Applet)this).getParameter("info");
- this.ivalign = ((Applet)this).getParameter("image_valign");
- this.ialign = ((Applet)this).getParameter("image_align");
-
- while(true) {
- this.field_18 = ((Applet)this).getParameter("image" + this.field_1);
- if (this.field_18 == null) {
- --this.field_1;
- if (this.field_1 < 0) {
- this.field_1 = 0;
- }
- break;
- }
-
- if (!this.field_18.endsWith(".gif") && !this.field_18.endsWith(".jpg")) {
- --this.field_1;
- if (this.field_1 < 0) {
- this.field_1 = 0;
- }
- break;
- }
-
- ++this.field_1;
- }
-
- this.num = this.field_1;
- this.img = new Image[this.num + 1];
- this.links = new String[this.num + 1];
- this.stb = new String[this.num + 1];
- this.imgw = new int[this.num + 1];
- this.imgh = new int[this.num + 1];
- this.dur = new int[this.num + 1];
-
- for(this.field_1 = 1; this.field_1 <= this.num; ++this.field_1) {
- this.img[this.field_1] = ((Applet)this).getImage(((Applet)this).getCodeBase(), "" + ((Applet)this).getParameter("image" + this.field_1));
- this.tracker.addImage(this.img[this.field_1], this.field_1 % 5);
- this.links[this.field_1] = ((Applet)this).getParameter("link" + this.field_1);
- this.stb[this.field_1] = ((Applet)this).getParameter("status_bar_msg" + this.field_1);
- if (this.links[this.field_1] == null) {
- this.dur[this.field_1] = 0;
- } else {
- this.dur[this.field_1] = 1;
- if (this.links[this.field_1].equals("") || this.links[this.field_1].equals(" ") || this.links[this.field_1].equals("no")) {
- this.dur[this.field_1] = 0;
- }
- }
- }
-
- this.durum = 0;
- }
-
- // $FF: renamed from: fi (java.lang.String, int, int) int
- public int method_0(String var1, int var2, int var3) {
- int var4 = 0;
-
- try {
- var4 = Integer.parseInt(var1, var2);
- } catch (Exception var5) {
- var4 = var3;
- }
-
- return var4;
- }
-
- public void ssts() {
- if (this.whb && this.inout == 1) {
- if (!this.field_21) {
- ((Applet)this).showStatus(" Unregistered version of Screw Java applet. URL: japplets.tripod.com");
- return;
- }
-
- if (this.stb[this.crr] != null) {
- ((Applet)this).showStatus("" + this.stb[this.crr]);
- }
- }
-
- }
-
- public void smc() {
- if (this.whb && this.inout == 1) {
- if (this.dur[this.crr] == 0) {
- ((Frame)((Component)this).getParent()).setCursor(0);
- return;
- }
-
- ((Frame)((Component)this).getParent()).setCursor(12);
- }
-
- }
-
- public boolean mouseEnter(Event var1, int var2, int var3) {
- if (this.whb) {
- if (this.durum != 2) {
- return true;
- }
-
- if (this.num <= 0) {
- return true;
- }
-
- this.inout = 1;
- this.ssts();
- ((Component)this).repaint();
- this.smc();
- }
-
- return true;
- }
-
- public boolean mouseExit(Event var1, int var2, int var3) {
- if (this.whb) {
- this.inout = 0;
- ((Applet)this).showStatus("");
- ((Frame)((Component)this).getParent()).setCursor(0);
- }
-
- return true;
- }
-
- public boolean mouseUp(Event var1, int var2, int var3) {
- if (this.whb) {
- if (this.dur[this.crr] == 0) {
- return true;
- }
-
- try {
- if (this.links[this.crr].startsWith("http://")) {
- this.field_22 = new URL("" + this.links[this.crr]);
- } else {
- this.field_22 = new URL(((Applet)this).getCodeBase(), "" + this.links[this.crr]);
- }
- } catch (Exception var4) {
- return true;
- }
-
- ((Applet)this).getAppletContext().showDocument(this.field_22, this.target_frame);
- }
-
- return true;
- }
-
- public void update(Graphics var1) {
- if (this.whb) {
- if (this.durum == 2) {
- this.field_17.flush();
- this.offg2.drawImage(this.field_17, this.field_12, this.field_13, (ImageObserver)null);
- }
-
- this.paint(var1);
- }
-
- }
-
- public void paint(Graphics var1) {
- if (this.whb) {
- if (this.durum == 2) {
- var1.drawImage(this.offi, 0, 0, this);
- return;
- }
-
- var1.setColor(Color.white);
- var1.fillRect(0, 0, this.field_10, this.field_11);
- var1.setColor(Color.black);
- if (this.durum == 0) {
- var1.drawString("Loading...", 10, 20);
- }
-
- if (this.durum == 1) {
- var1.drawString("Images", 10, 20);
- var1.drawString("not found.", 10, 36);
- }
-
- if (this.durum == 3) {
- var1.drawString("Images must be", 10, 20);
- var1.drawString("the same size.", 10, 36);
- }
-
- if (this.durum == 4) {
- var1.drawString("Info parameter", 10, 20);
- var1.drawString("error.", 10, 36);
- }
- }
-
- }
-
- public void start() {
- if (this.field_0 == null || !this.field_0.isAlive()) {
- this.field_0 = new Thread(this);
- }
-
- this.field_0.start();
- }
-
- public void stop() {
- if (this.field_0 != null) {
- this.field_0.stop();
- this.field_0 = null;
- }
-
- }
-
- public void destroy() {
- this.field_0 = null;
- }
-
- public void run() {
- ((Component)this).show();
- this.field_10 = ((Component)this).size().width;
- this.field_11 = ((Component)this).size().height;
- if (!this.whb) {
- this.offi = ((Component)this).createImage(this.field_10, this.field_11);
- this.offg2 = this.offi.getGraphics();
- this.offg2.setColor(this.bgc);
- this.offg2.fillRect(0, 0, this.field_10, this.field_11);
- }
-
- this.whb = true;
- this.durum = 0;
-
- try {
- this.tracker.waitForAll();
- } catch (InterruptedException var10) {
- }
-
- if (this.tracker.isErrorAny()) {
- this.durum = 1;
- ((Component)this).repaint();
- } else {
- for(this.field_1 = 1; this.field_1 <= this.num; ++this.field_1) {
- this.imgw[this.field_1] = this.img[this.field_1].getWidth(this);
- this.imgh[this.field_1] = this.img[this.field_1].getHeight(this);
- if (this.field_1 > 1 && (this.imgw[this.field_1] != this.imgw[this.field_1 - 1] || this.imgh[this.field_1] != this.imgh[this.field_1 - 1])) {
- this.durum = 3;
- ((Component)this).repaint();
- return;
- }
-
- this.field_3 = this.imgw[this.field_1];
- this.field_4 = this.imgh[this.field_1];
- }
-
- if (this.ialign != null) {
- if (this.field_3 < this.field_10) {
- this.field_12 = 0;
- if (this.ialign.equals("center")) {
- this.field_12 = (this.field_10 - this.field_3) / 2;
- }
-
- if (this.ialign.equals("right")) {
- this.field_12 = this.field_10 - this.field_3;
- }
- } else {
- this.field_12 = 0;
- if (this.ialign.equals("center")) {
- this.field_12 = -1 * ((this.field_3 - this.field_10) / 2);
- }
-
- if (this.ialign.equals("right")) {
- this.field_12 = this.field_10 - this.field_3;
- }
- }
- }
-
- if (this.ivalign != null && this.field_4 < this.field_11) {
- if (this.ivalign.equals("center")) {
- this.field_13 = (this.field_11 - this.field_4) / 2;
- }
-
- if (this.ivalign.equals("bottom")) {
- this.field_13 = this.field_11 - this.field_4;
- }
- }
-
- if (this.infostr == null) {
- this.durum = 4;
- ((Component)this).repaint();
- } else {
- if (this.infostr.equals("Applet by Gokhan Dagli,japplets.tripod.com")) {
- this.field_20 = new int[this.num + 1][this.field_3 * this.field_4];
- this.isle = new int[this.field_3 * this.field_4];
- this.acd = new double[this.field_3 * this.field_4];
- this.MIS = new MemoryImageSource(this.field_3, this.field_4, this.isle, 0, this.field_3);
-
- for(this.field_1 = 1; this.field_1 <= this.num; ++this.field_1) {
- this.field_19 = new PixelGrabber(this.img[this.field_1].getSource(), 0, 0, this.field_3, this.field_4, this.field_20[this.field_1], 0, this.field_3);
-
- try {
- this.field_19.grabPixels();
- } catch (Exception var9) {
- }
- }
-
- this.field_15 = this.field_3 / 2;
- this.field_16 = this.field_4 / 2;
- if (this.modd == 0) {
- this.alfa = (Math.PI * 2D) / (double)this.field_14;
- } else {
- this.alfa = Math.PI / (double)this.field_14;
- }
-
- for(this.field_1 = 0; this.field_1 < this.field_3 * this.field_4; ++this.field_1) {
- this.isle[this.field_1] = this.field_20[1][this.field_1];
- double var1 = (double)this.field_16 - Math.floor((double)(this.field_1 / this.field_3));
- double var3 = (double)(this.field_1 % this.field_3 - this.field_15);
- double var5 = Math.atan(var1 / var3);
- if (var5 < (double)0.0F) {
- var5 *= (double)-1.0F;
- }
-
- if (this.modd == 0 && var1 < (double)0.0F & var3 < (double)0.0F) {
- var5 += Math.PI;
- }
-
- if ((this.modd == 0 || this.modd == 1) && var1 >= (double)0.0F & var3 < (double)0.0F) {
- var5 = Math.PI - var5;
- }
-
- if (this.modd == 0 && var1 < (double)0.0F & var3 >= (double)0.0F) {
- var5 = (Math.PI * 2D) - var5;
- }
-
- if (this.modd == 1 && var1 < (double)0.0F & var3 >= (double)0.0F) {
- var5 = Math.PI - var5;
- }
-
- this.acd[this.field_1] = var5 - 0.0031415926535897933;
- if (var5 < (double)0.0F) {
- var5 = (double)0.0F;
- }
- }
-
- this.field_17 = ((Component)this).createImage(this.MIS);
- this.durum = 2;
- ((Component)this).repaint();
- this.field_5 = 1;
- this.field_1 = 0;
- this.field_6 = 0;
- this.cit = -1;
-
- while(true) {
- if (this.cit != this.field_6) {
- this.cit = this.field_6;
- this.field_9 = this.field_8;
- } else {
- this.field_9 = this.dly;
- }
-
- try {
- Thread.sleep((long)this.field_9);
- } catch (InterruptedException var8) {
- ((Throwable)var8).printStackTrace();
- }
-
- this.field_7 = this.field_6 % this.num + 1;
- this.md2 = this.field_7 % this.num + 1;
- this.field_1 = 0;
- if (this.field_5 > this.field_14 / 2) {
- this.crr = this.md2;
- this.ssts();
- this.smc();
- } else {
- this.crr = this.field_7;
- }
-
- this.alfasin = Math.sin((double)this.field_5 * this.alfa);
- if (this.field_5 == this.field_14) {
- if (this.modd == 0) {
- this.alfasin = (Math.PI * 2D);
- } else {
- this.alfasin = Math.PI;
- }
- }
-
- for(this.field_1 = 0; this.field_1 < this.field_3 * this.field_4; ++this.field_1) {
- if (this.acd[this.field_1] <= (double)this.field_5 * this.alfa) {
- this.isle[this.field_1] = this.field_20[this.md2][this.field_1];
- } else {
- this.isle[this.field_1] = this.field_20[this.field_7][this.field_1];
- }
- }
-
- this.isle[this.field_3 * this.field_16 + this.field_15] = this.field_20[this.md2][this.field_3 * this.field_16 + this.field_15];
- ++this.field_5;
- if (this.field_5 > this.field_14) {
- this.field_5 = 1;
- ++this.field_6;
- }
-
- ((Component)this).repaint();
- }
- }
-
- this.durum = 4;
- ((Component)this).repaint();
- }
- }
- }
- }
-